package edu.whu.notepal.utils;

import edu.whu.notepal.pojo.User;

/**
 * 线程存储用户信息的类
 * @author 陈磊
 */
public class UserHolder {
    private static final ThreadLocal<User> tl = new ThreadLocal<>();

    public static void saveUser(User user){
        tl.set(user);
    }

    public static User getUser(){
        return tl.get();
    }

    public static void removeUser(){
        tl.remove();
    }
}